package com.cn.por.util.html;

import com.cn.por.util.io.IoTest;
import org.jsoup.nodes.Document;
import org.jsoup.parser.Parser;

import java.io.*;

/**
 * 将html解析为java对象
 */
public class HtmlJsoupParser {

    public static void main(String[] args) {
        ClassLoader classLoader = IoTest.class.getClassLoader();
        InputStream inputStream = classLoader.getResourceAsStream("generator/vue/echartsTree.html");

        try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) {
            StringBuilder result = new StringBuilder();
            String line;
            while ((line = reader.readLine()) != null) {
                result.append(line).append("\n");
            }
            Document dc = Parser.parse(result.toString(), "https://www.example.com");
            dc.body();

        } catch (IOException e) {
            throw new RuntimeException(e);
        }

    }
}
